package com.zq.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import com.zq.common.annotation.Log;
import com.zq.common.core.controller.BaseController;
import com.zq.common.core.domain.AjaxResult;
import com.zq.common.core.domain.Result;
import com.zq.common.core.page.TableDataInfo;
import com.zq.common.enums.BusinessType;
import com.zq.server.api.domain.entity.ApiTeam;
import com.zq.server.api.service.IApiTeamService;

/**
 * 战队功能模块Controller
 * 
 * @author 财哥
 * @date 2024-03-31
 */
@RestController
@RequestMapping("/ApiTeam")
public class ApiTeamController extends BaseController
{
    @Autowired
    private IApiTeamService apiTeamService;

    /**
     * 查询战队功能模块列表
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeam:list')")
    @GetMapping("/list")
    public TableDataInfo list(ApiTeam apiTeam)
    {
        startPage();
        List<ApiTeam> list = apiTeamService.selectApiTeamList(apiTeam);
        return getDataTable(list);
    }

//    /**
//     * 导出战队功能模块列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:ApiTeam:export')")
//    @Log(title = "战队功能模块", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, ApiTeam apiTeam)
//    {
//        List<ApiTeam> list = apiTeamService.selectApiTeamList(apiTeam);
//        ExcelUtil<ApiTeam> util = new ExcelUtil<ApiTeam>(ApiTeam.class);
//        util.exportExcel(response, list, "战队功能模块数据");
//    }

    /**
     * 获取战队功能模块详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeam:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(apiTeamService.selectApiTeamById(id));
    }

    /**
     * 新增战队功能模块
     */
    @Log(title = "新增战队功能模块", businessType = BusinessType.INSERT)
    @PostMapping("/insertTeam")
    public Result add(@RequestBody ApiTeam apiTeam)
    {
        return apiTeamService.addTeam(apiTeam);
    }

    /**
     * 修改战队功能模块
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeam:edit')")
    @Log(title = "战队功能模块", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApiTeam apiTeam)
    {
        return toAjax(apiTeamService.updateApiTeam(apiTeam));
    }

    /**
     * 删除战队功能模块
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeam:remove')")
    @Log(title = "战队功能模块", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(apiTeamService.deleteApiTeamByIds(ids));
    }
}
